#include <string>

#include "attribute.h"

using namespace std;

Attribute::Attribute (string& aName, Type aType, Constraint aConstraint, string aDefault) : name (aName), type (aType), constraint (aConstraint), def (aDefault) {
}

Attribute::~Attribute () {
}

void Attribute::print(ostream& out) {
	out << "	" << name << " ";
	printType(out);
	out << " ";
	printConstraint(out);
	out << " " << def << "\n";
}

ostream& Attribute::printConstraint(ostream& out) {
	switch (constraint) {
	case IMPLIED:
		out << "#IMPLIED";
		break;
	case REQUIRED:
		out << "#REQUIRED";
		break;
	};
	
	return out;
}

ostream& Attribute::printType(ostream& out) {
	switch (type) {
	case CDATA:
		out << "CDATA";
		break;
	};
	
	return out;
}
